package com.glebusheg.data 
{
	import com.glebusheg.asset.AssetManager;
	import com.glebusheg.debug.Console;
	/**
	 * ...
	 * @author Gleb Volkov
	 */
	public class AppData 
	{
		static public function initialize():void
		{
			_items = ItemUtil.createItemsFromXML(_items, AssetManager.getXML("items_data"));
			MarketData.parse(AssetManager.getXML("shop_data"));
		}
		
		static private var _items:Object = {};
		static public function hasItem(name:String):Boolean 
		{
			return name && _items.hasOwnProperty(name);
		}
		
		static public function getItem(name:String):Item
		{
			var result:Item;
			if(name && _items.hasOwnProperty(name))
				result = _items[name] as Item;
			else
				Console.warn("Item '" + name + "' not found.");
				
			return result;
		}
		
	}

}